package cn.edu.scau.dormitory_management_system.module.examine.service.impl;

import cn.edu.scau.dormitory_management_system.module.examine.dao.DormAdjustAuditDao;
import cn.edu.scau.dormitory_management_system.module.examine.entity.DormAdjustAuditEntity;
import cn.edu.scau.dormitory_management_system.module.examine.entity.VO.DormAdjustAuditVO;
import cn.edu.scau.dormitory_management_system.module.examine.service.DormAdjustAuditService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Vizzk
 * @description：TODO
 * @date ：2021/8/19 18:22
 */
@Service("dormAdjustAuditService")
public class DormAdjustAuditServiceImpl extends ServiceImpl<DormAdjustAuditDao, DormAdjustAuditEntity> implements DormAdjustAuditService {
    @Override
    public boolean insertDormAdjustAudit(DormAdjustAuditEntity auditEntity) {
        return this.baseMapper.insert(auditEntity)>0;
    }
    @Override
    public List<DormAdjustAuditEntity> listAuditsByDormAdjustId(Integer adjustId) {
        QueryWrapper<DormAdjustAuditEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("adjust_id",adjustId);
        return this.baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<DormAdjustAuditVO> listAuditVOByDormAdjustId(Integer adjustId) {
        return this.baseMapper.listAuditVOByDormAdjustId(adjustId);
    }

    @Override
    public boolean deleteByAdjustId(Integer id) {
        return this.baseMapper.deleteByAdjustId(id);
    }
}
